<template>
  <div>
    <van-nav-bar
      title="修改个人信息"
      left-text="返回"
      right-text="保存"
      left-arrow
      @click-left="$router.go(-1)"
      @click-right="onClickRight"
    />
    <van-radio-group v-model="value">
      <van-cell-group>
        <van-cell title="男" clickable @click="q1">
          <template #right-icon>
            <van-radio name="0" />
          </template>
        </van-cell>
        <van-cell title="女" clickable @click="q2">
          <template #right-icon>
            <van-radio name="1" />
          </template>
        </van-cell>
      </van-cell-group>
    </van-radio-group>
  </div>
</template>

<script>
import { Toast } from "vant";
import { getuser } from "../../../request/http";
export default {
  data() {
    return {
      value: "",
      list: [],
    };
  },
  created() {
    console.log(this.$route.query.sex);
    this.value = this.$route.query.sex;
   
  },
  methods: {
    q1(){
        this.value="0"
     console.log(this.value);
    },
    q2(){
     this.value="1"
     console.log(this.value);
    },
    onClickRight() {
      getuser({ sex: this.value }).then((res) => {
        console.log(res);
        Toast.success("修改成功");
        this.$router.push("/info");
      });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>